<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;

use cmf\controller\HomeBaseController;
use think\Db;

class IndexController extends HomeBaseController
{
    public function index()
    {
        $ck_news = Db::connect('maker_db')->table('news_1')->where(['lmid'=>'|56|58|'])->order('id DESC')->limit(4)->select();//创客新闻
        $where = [
            'published_time' => [['< time', time()], ['> time', 0]],
            'post_status'    => 1,
            'delete_time'    => 0
        ];
        $post_ids = Db::connect('school_db')->table('xy_portal_category_post')->where('category_id',8)->column('post_id');

        $school_news = Db::connect('school_db')->table('xy_portal_post')->where($where)->whereIn('id',$post_ids)->order('id DESC')->limit(4)->select();//学院新闻

        $this->assign('ck_news',$ck_news);
        $this->assign('school_news',$school_news);
        return $this->fetch(':index');
    }
}
